home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / netwm.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-10-08  |  46.7 KB  |  1,472 lines

  1. /*
  2.  
  3.   Copyright (c) 2000 Troll Tech AS
  4.   Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
  5.  
  6.   Permission is hereby granted, free of charge, to any person obtaining a
  7.   copy of this software and associated documentation files (the "Software"),
  8.   to deal in the Software without restriction, including without limitation
  9.   the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10.   and/or sell copies of the Software, and to permit persons to whom the
  11.   Software is furnished to do so, subject to the following conditions:
  12.  
  13.   The above copyright notice and this permission notice shall be included in
  14.   all copies or substantial portions of the Software.
  15.  
  16.   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17.   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18.   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  19.   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20.   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21.   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22.   DEALINGS IN THE SOFTWARE.
  23.  
  24. */
  25.  
  26.  
  27. #ifndef   __net_wm_h
  28. #define   __net_wm_h
  29.  
  30. #include "kdelibs_export.h"
  31. #include <qwidget.h>
  32. #ifdef Q_WS_X11
  33. #include <X11/Xlib.h>
  34. #include <X11/Xutil.h>
  35. #include <X11/Xatom.h>
  36.  
  37. #include "netwm_def.h"
  38.  
  39. // forward declaration
  40. struct NETRootInfoPrivate;
  41. struct NETWinInfoPrivate;
  42. template <class Z> class NETRArray;
  43.  
  44.  
  45. /**
  46.    Common API for root window properties/protocols.
  47.  
  48.    The NETRootInfo class provides a common API for clients and window managers
  49.    to set/read/change properties on the root window as defined by the NET Window
  50.    Manager Specification..
  51.  
  52.    @author Bradley T. Hughes <bhughes@trolltech.com>
  53.    @see NET
  54.    @see NETWinInfo
  55.    @see KWin
  56.  **/
  57.  
  58. class KDECORE_EXPORT NETRootInfo : public NET {
  59. public:
  60.     /**
  61.         Indexes for the properties array.
  62.         @since 3.2
  63.     **/
  64.     // update also NETRootInfoPrivate::properties[] size when extending this
  65.     enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
  66.         PROPERTIES_SIZE };
  67.  
  68.     /**
  69.        Window Managers should use this constructor to create a NETRootInfo object,
  70.        which will be used to set/update information stored on the rootWindow.
  71.        The application role is automatically set to WindowManager
  72.        when using this constructor.
  73.  
  74.        @param display An X11 Display struct.
  75.  
  76.        @param supportWindow The Window id of the supportWindow.  The supportWindow
  77.        must be created by the window manager as a child of the rootWindow.  The
  78.        supportWindow must not be destroyed until the Window Manager exits.
  79.  
  80.        @param wmName A string which should be the window manager's name (ie. "KWin"
  81.        or "Blackbox").
  82.  
  83.        @param properties An array of elements listing all properties and protocols
  84.        the window manager supports. The elements contain OR'ed values of constants
  85.        from the NET base class, in the following order: [0]= NET::Property,
  86.        [1]= NET::WindowTypeMask (not NET::WindowType!), [2]= NET::State,
  87.        [3]= NET::Property2, [4]= NET::Action.
  88.        In future versions, the list may be extended. In case you pass less elements,
  89.        the missing ones will be replaced with default values.
  90.        
  91.        @param properties_size The number of elements in the properties array.
  92.  
  93.        @param screen For Window Managers that support multiple screen (ie.
  94.        "multiheaded") displays, the screen number may be explicitly defined.  If
  95.        this argument is omitted, the default screen will be used.
  96.        
  97.        @param doActivate true to activate the window
  98.        
  99.        @since 3.2
  100.     **/
  101.     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
  102.         const unsigned long properties[], int properties_size,
  103.                 int screen = -1, bool doActivate = true);
  104.  
  105.     /**
  106.         @deprecated
  107.         This constructor differs from the above one only in the way it accepts
  108.         the list of supported properties. The properties argument is equivalent
  109.         to the first element of the properties array in the above constructor.
  110.     **/
  111.     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
  112.         unsigned long properties, int screen = -1, bool doActivate = true) KDE_DEPRECATED;
  113.  
  114.     /**
  115.        Clients should use this constructor to create a NETRootInfo object, which
  116.        will be used to query information set on the root window. The application
  117.        role is automatically set to Client when using this constructor.
  118.  
  119.        @param display An X11 Display struct.
  120.  
  121.        @param properties An array of elements listing all protocols the client
  122.        is interested in. The elements contain OR'ed values of constants
  123.        from the NET base class, in the following order: [0]= NET::Property,
  124.        [1]= NET::Property2.
  125.  
  126.        @param properties_size The number of elements in the properties array.
  127.  
  128.        @param screen For Clients that support multiple screen (ie. "multiheaded")
  129.        displays, the screen number may be explicitly defined. If this argument is
  130.        omitted, the default screen will be used.
  131.        
  132.        @param doActivate true to activate the window
  133.  
  134.        @since 3.2
  135.     **/
  136.     NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
  137.                 int screen = -1, bool doActivate = true);
  138.  
  139.     /**
  140.         This constructor differs from the above one only in the way it accepts
  141.         the list of supported properties. The properties argument is equivalent
  142.         to the first element of the properties array in the above constructor,
  143.         and therefore you cannot read all root window properties using it.
  144.     **/
  145.     NETRootInfo(Display *display, unsigned long properties, int screen = -1,
  146.         bool doActivate = true);
  147.  
  148.     /**
  149.        Creates a shared copy of the specified NETRootInfo object.
  150.        
  151.        @param rootinfo the NETRootInfo object to copy
  152.     **/
  153.     NETRootInfo(const NETRootInfo &rootinfo);
  154.  
  155.     /**
  156.        Destroys the NETRootInfo object.
  157.     **/
  158.     virtual ~NETRootInfo();
  159.  
  160.     /**
  161.        Returns the X11 Display struct used.
  162.  
  163.        @return the X11 Display
  164.     **/
  165.     Display *x11Display() const;
  166.  
  167.     /**
  168.        Returns the Window id of the rootWindow.
  169.  
  170.        @return the id of the root window
  171.     **/
  172.     Window rootWindow() const;
  173.  
  174.     /**
  175.        Returns the Window id of the supportWindow.
  176.  
  177.        @return the id of the support window
  178.     **/
  179.     Window supportWindow() const;
  180.  
  181.     /**
  182.        Returns the name of the Window Manager.
  183.  
  184.        @return the name of the window manager
  185.     **/
  186.     const char *wmName() const;
  187.  
  188.     /**
  189.        Returns the screenNumber.
  190.  
  191.        @return the screen number
  192.     **/
  193.     int screenNumber() const;
  194.  
  195.     /**
  196.        Returns true if the given property is supported by the window
  197.        manager. Note that for Client mode, NET::Supported needs
  198.        to be passed in the properties argument for this to work.
  199.        @since 3.2
  200.     **/
  201.     bool isSupported( NET::Property property ) const;
  202.     /**
  203.        @overload
  204.        @since 3.2
  205.     **/
  206.     bool isSupported( NET::Property2 property ) const;
  207.     /**
  208.        @overload
  209.        @since 3.2
  210.     **/
  211.     bool isSupported( NET::WindowType type ) const;
  212.     /**
  213.        @overload
  214.        @since 3.2
  215.     **/
  216.     bool isSupported( NET::State state ) const;
  217.  
  218.     /**
  219.        @overload
  220.        @since 3.2
  221.     **/
  222.     bool isSupported( NET::Action action ) const;
  223.  
  224.     /**
  225.        In the Window Manager mode, this is equivalent to the properties
  226.        argument passed to the constructor. In the Client mode, if
  227.        NET::Supported was passed in the properties argument, the returned
  228.        value is array of all protocols and properties supported
  229.        by the Window Manager. The elements of the array are the same
  230.        as they would be passed to the Window Manager mode constructor,
  231.        the size is the maximum array size the constructor accepts.
  232.        
  233.        @since 3.2
  234.     **/
  235.     const unsigned long* supportedProperties() const;
  236.  
  237.     /**
  238.        Returns the properties argument passed to the constructor.
  239.        The size is the maximum array size the constructor accepts.
  240.  
  241.        @since 3.2
  242.     **/
  243.     // KDE4 better name?
  244.     const unsigned long* passedProperties() const;
  245.  
  246.     /**
  247.        @deprecated
  248.        
  249.        Returns an OR'ed list of protocols passed to the constructor.
  250.        For the constructor used by Window Managers, this is equivalent
  251.        to the first element of the properties argument, for the constructor
  252.        for Clients, it's the properties argument.
  253.        
  254.        Clients willing to find out all properties and protocols supported
  255.        by the WindowManager should use supportedProperties().
  256.        
  257.        @return an OR'ed list of protocols
  258.  
  259.        @see NET::Property
  260.     **/
  261.     unsigned long supported() const KDE_DEPRECATED;
  262.  
  263.     /**
  264.        Returns an array of Window id's, which contain all managed windows.
  265.  
  266.        @return the array of Window id's
  267.  
  268.        @see clientListCount()
  269.     **/
  270.     const Window *clientList() const;
  271.  
  272.     /**
  273.        Returns the number of managed windows in clientList array.
  274.  
  275.        @return the number of managed windows in the clientList array
  276.  
  277.        @see clientList()
  278.     **/
  279.     int clientListCount() const;
  280.  
  281.     /**
  282.        Returns an array of Window id's, which contain all managed windows in
  283.        stacking order.
  284.  
  285.        @return the array of Window id's in stacking order
  286.        
  287.        @see clientListStackingCount()
  288.     **/
  289.     const Window *clientListStacking() const;
  290.  
  291.     /**
  292.        Returns the number of managed windows in the clientListStacking array.
  293.  
  294.        @return the number of Window id's in the client list
  295.  
  296.        @see clientListStacking()
  297.     **/
  298.     int clientListStackingCount() const;
  299.  
  300.     /**
  301.        Returns an array of Window id's, which contain all KDE system tray windows.
  302.  
  303.        @return the array of Window id's of system tray windows
  304.  
  305.        @see kdeSystemTrayWindowsCount()
  306.     **/
  307.     const Window *kdeSystemTrayWindows() const;
  308.  
  309.     /**
  310.        Returns the number of windows in the kdeSystemTrayWindows array.
  311.  
  312.        @return the number of Window id's in the system tray list
  313.  
  314.        @see kdeSystemTrayWindows()
  315.     **/
  316.     int kdeSystemTrayWindowsCount() const;
  317.  
  318.     /**
  319.        Returns the desktop geometry size.
  320.  
  321.        The desktop argument is ignored. Early drafts of the NET WM
  322.        Specification were unclear about the semantics of this property.
  323.  
  324.        @param desktop the number of the desktop
  325.  
  326.        @return the size of the desktop
  327.     **/
  328.     NETSize desktopGeometry(int desktop) const;
  329.  
  330.     /**
  331.        Returns the viewport of the specified desktop.
  332.  
  333.        @param desktop the number of the desktop
  334.  
  335.        @return the position of the desktop's viewport
  336.     **/
  337.     NETPoint desktopViewport(int desktop) const;
  338.  
  339.     /**
  340.        Returns the workArea for the specified desktop.
  341.  
  342.        @param desktop the number of the desktop
  343.  
  344.        @return the size of the work area
  345.     **/
  346.     NETRect workArea(int desktop) const;
  347.  
  348.     /**
  349.        Returns the name for the specified desktop.
  350.  
  351.        @param desktop the number of the desktop
  352.  
  353.        @return the name of the desktop
  354.     **/
  355.     const char *desktopName(int desktop) const;
  356.  
  357.     /**
  358.        Returns an array of Window id's, which contain the virtual root windows.
  359.        
  360.        @return the array of Window id's
  361.  
  362.        @see virtualRootsCount()
  363.     **/
  364.     const Window *virtualRoots( ) const;
  365.  
  366.     /**
  367.        Returns the number of window in the virtualRoots array.
  368.  
  369.        @return the number of Window id's in the virtual root array
  370.  
  371.        @see virtualRoots()
  372.     **/
  373.     int virtualRootsCount() const;
  374.  
  375.     /**
  376.        Returns the desktop layout orientation.
  377.     **/
  378.     NET::Orientation desktopLayoutOrientation() const;
  379.  
  380.     /**
  381.        Returns the desktop layout number of columns and rows. Note that
  382.        either may be 0 (see _NET_DESKTOP_LAYOUT).
  383.     **/
  384.     QSize desktopLayoutColumnsRows() const;
  385.  
  386.     /**
  387.        Returns the desktop layout starting corner.
  388.     **/
  389.     NET::DesktopLayoutCorner desktopLayoutCorner() const;
  390.  
  391.     /**
  392.        Returns the number of desktops.
  393.  
  394.        @return the number of desktops
  395.     **/
  396.     int numberOfDesktops() const;
  397.  
  398.     /**
  399.        Returns the current desktop.
  400.  
  401.        @return the number of the current desktop
  402.     **/
  403.     int currentDesktop() const;
  404.  
  405.     /**
  406.        Returns the active (focused) window.
  407.  
  408.        @return the id of the active window
  409.     **/
  410.     Window activeWindow() const;
  411.  
  412.     /**
  413.        Window Managers must call this after creating the NETRootInfo object, and
  414.        before using any other method in the class.  This method sets initial data
  415.        on the root window and does other post-construction duties.
  416.  
  417.        Clients must also call this after creating the object to do an initial
  418.        data read/update.
  419.     **/
  420.     void activate();
  421.  
  422.     /**
  423.        Sets the list of managed windows on the Root/Desktop window.
  424.  
  425.        @param windows The array of Window id's
  426.  
  427.        @param count The number of windows in the array
  428.     **/
  429.     // KDE4 'const Window*', also in the others below
  430.     void setClientList(Window *windows, unsigned int count);
  431.  
  432.     /**
  433.        Sets the list of managed windows in stacking order on the Root/Desktop
  434.        window.
  435.  
  436.        @param windows The array of Window id's
  437.  
  438.        @param count The number of windows in the array.
  439.     **/
  440.     void setClientListStacking(Window *windows, unsigned int count);
  441.  
  442.     /**
  443.        Sets the list of KDE system tray windows on the root window.
  444.  
  445.        @param windows The array of window id's
  446.  
  447.        @param count The number of windows in the array.
  448.     **/
  449.     void setKDESystemTrayWindows(Window *windows, unsigned int count);
  450.  
  451.     /**
  452.        Sets the current desktop to the specified desktop.
  453.  
  454.        @param desktop the number of the desktop
  455.     **/
  456.     void setCurrentDesktop(int desktop);
  457.  
  458.     /**
  459.        Sets the desktop geometry to the specified geometry.
  460.  
  461.        The desktop argument is ignored. Early drafts of the NET WM
  462.        Specification were unclear about the semantics of this property.
  463.  
  464.        @param desktop the number of the desktop
  465.  
  466.        @param geometry the new size of the desktop
  467.     **/
  468.     void setDesktopGeometry(int desktop, const NETSize &geometry);
  469.  
  470.     /**
  471.        Sets the viewport for the current desktop to the specified point.
  472.  
  473.        @param desktop the number of the desktop
  474.  
  475.        @param viewport the new position of the desktop's viewport
  476.     **/
  477.     void setDesktopViewport(int desktop, const NETPoint &viewport);
  478.  
  479.     /**
  480.        Sets the number of desktops the the specified number.
  481.  
  482.        @param numberOfDesktops the number of desktops
  483.     **/
  484.     void setNumberOfDesktops(int numberOfDesktops);
  485.  
  486.     /**
  487.        Sets the name of the specified desktop.
  488.  
  489.        @param desktop the number of the desktop
  490.  
  491.        @param desktopName the new name of the desktop
  492.     **/
  493.     void setDesktopName(int desktop, const char *desktopName);
  494.  
  495.     /**
  496.        Requests that the specified window becomes the active (focused) one.
  497.  
  498.        @param window the id of the new active window
  499.        @param src whether the request comes from normal application
  500.           or from a pager or similar tool
  501.        @param timestamp X server timestamp of the user action that
  502.           caused the request
  503.        @param active_window active window of the requesting application, if any
  504.           
  505.        @since 3.2
  506.     **/
  507.     void setActiveWindow(Window window, NET::RequestSource src,
  508.         Time timestamp, Window active_window);
  509.  
  510.     /**
  511.        Sets the active (focused) window the specified window. This should
  512.        be used only in the window manager mode.
  513.  
  514.        @param window the if of the new active window
  515.     **/
  516.     void setActiveWindow(Window window);
  517.  
  518.     /**
  519.        Sets the workarea for the specified desktop
  520.  
  521.        @param desktop the number of the desktop
  522.  
  523.        @param workArea the new work area of the desktop
  524.     **/
  525.     void setWorkArea(int desktop, const NETRect &workArea);
  526.  
  527.     /**
  528.        Sets the list of virtual root windows on the root window.
  529.  
  530.        @param windows The array of Window id's
  531.  
  532.        @param count The number of windows in the array.
  533.     **/
  534.     void setVirtualRoots(Window *windows, unsigned int count);
  535.     
  536.     /**
  537.        Sets the desktop layout. This is set by the pager. When setting, the pager must
  538.        own the _NET_DESKTOP_LAYOUT_Sn manager selection. See _NET_DESKTOP_LAYOUT for details.
  539.     **/
  540.     void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
  541.         NET::DesktopLayoutCorner corner);
  542.  
  543.     /**
  544.      * Sets the _NET_SHOWING_DESKTOP status (whether desktop is being shown).
  545.      * @since 3.5
  546.      */
  547.     void setShowingDesktop( bool showing );
  548.     /**
  549.      * Returns the status of _NET_SHOWING_DESKTOP.
  550.      * @since 3.5
  551.      */
  552.     bool showingDesktop() const;
  553.  
  554.     /**
  555.        Assignment operator.  Ensures that the shared data reference counts are
  556.        correct.
  557.     **/
  558.     const NETRootInfo &operator=(const NETRootInfo &rootinfo);
  559.  
  560.     /**
  561.        Clients (such as pagers/taskbars) that wish to close a window should call
  562.        this function.  This will send a request to the Window Manager, which
  563.        usually can usually decide how to react to such requests.
  564.  
  565.        @param window the id of the window to close
  566.     **/
  567.     void closeWindowRequest(Window window);
  568.  
  569.     /**
  570.        Clients (such as pagers/taskbars) that wish to start a WMMoveResize
  571.        (where the window manager controls the resize/movement,
  572.        i.e. _NET_WM_MOVERESIZE) should call this function.
  573.        This will send a request to the Window Manager.
  574.  
  575.        @param window The client window that would be resized/moved.
  576.  
  577.        @param x_root X position of the cursor relative to the root window.
  578.  
  579.        @param y_root Y position of the cursor relative to the root window.
  580.  
  581.        @param direction One of NET::Direction (see base class documentation for
  582.        a description of the different directions).
  583.     **/
  584.     void moveResizeRequest(Window window, int x_root, int y_root,
  585.                Direction direction);
  586.  
  587.     /**
  588.        Clients (such as pagers/taskbars) that wish to move/resize a window
  589.        using WM2MoveResizeWindow (_NET_MOVERESIZE_WINDOW) should call this function.
  590.        This will send a request to the Window Manager. See _NET_MOVERESIZE_WINDOW
  591.        description for details.
  592.  
  593.        @param window The client window that would be resized/moved.
  594.        @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
  595.        @param x Requested X position for the window
  596.        @param y Requested Y position for the window
  597.        @param width Requested width for the window
  598.        @param height Requested height for the window
  599.        
  600.        @since 3.2
  601.     **/
  602.     void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
  603.  
  604.     /**
  605.        Sends the _NET_RESTACK_WINDOW request.
  606.        @since 3.3
  607.     **/
  608.     void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
  609.     /**
  610.        @obsolete
  611.        @since 3.2
  612.     **/
  613.     void restackRequest(Window window, Window above, int detail);
  614.     
  615.     /**
  616.        This function takes the passed XEvent and returns an OR'ed list of
  617.        NETRootInfo properties that have changed in the properties argument.
  618.        The new information will be read immediately by the class.
  619.        The elements of the properties argument are as they would be passed
  620.        to the constructor, if the array is not large enough,
  621.        changed properties that don't fit in it won't be listed there
  622.        (they'll be updated in the class though).
  623.        
  624.        @param event the event
  625.        @param properties properties that changed
  626.        @param properties_size size of the passed properties array
  627.        @since 3.2
  628.  
  629.     **/
  630.     void event( XEvent* event, unsigned long* properties, int properties_size );
  631.     
  632.     /**
  633.        This function takes the passed XEvent and returns an OR'ed list of
  634.        NETRootInfo properties that have changed.  The new information will be
  635.        read immediately by the class. This overloaded version returns
  636.        only a single mask, and therefore cannot check state of all properties
  637.        like the other variant.
  638.  
  639.        @param event the event
  640.  
  641.        @return the properties
  642.     **/
  643.     unsigned long event(XEvent *event);
  644.  
  645.  
  646. protected:
  647.     /**
  648.        A Client should subclass NETRootInfo and reimplement this function when
  649.        it wants to know when a window has been added.
  650.        
  651.        @param window the id of the window to add
  652.     **/
  653.     virtual void addClient(Window window) { Q_UNUSED(window); }
  654.  
  655.     /**
  656.        A Client should subclass NETRootInfo and reimplement this function when
  657.        it wants to know when a window has been removed.
  658.  
  659.        @param window the id of the window to remove
  660.     **/
  661.     virtual void removeClient(Window window) { Q_UNUSED(window); }
  662.  
  663.     /**
  664.        A Client should subclass NETRootInfo and reimplement this function when
  665.        it wants to know when a system tray window has been added.  This is a KDE 2.0
  666.        extension.
  667.  
  668.        @param window the id of the window to add
  669.     **/
  670.     virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
  671.  
  672.     /**
  673.        A Client should subclass NETRootInfo and reimplement this function when
  674.        it wants to know when a system tray window has been removed.  This is a KDE 2.0
  675.        extension.
  676.        
  677.        @param window the id of the window to remove
  678.     **/
  679.     virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
  680.  
  681.     /**
  682.        A Window Manager should subclass NETRootInfo and reimplement this function
  683.        when it wants to know when a Client made a request to change the number
  684.        of desktops.
  685.  
  686.        @param numberOfDesktops the new number of desktops
  687.     **/
  688.     virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
  689.  
  690.     /**
  691.        A Window Manager should subclass NETRootInfo and reimplement this function
  692.        when it wants to know when a Client made a request to change the specified
  693.        desktop geometry.
  694.  
  695.        @param desktop the number of the desktop
  696.  
  697.        @param geom the new size
  698.     **/
  699.     virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
  700.  
  701.     /**
  702.        A Window Manager should subclass NETRootInfo and reimplement this function
  703.        when it wants to know when a Client made a request to change the specified
  704.        desktop viewport.
  705.  
  706.        @param desktop the number of the desktop
  707.  
  708.        @param viewport the new position of the viewport
  709.     **/
  710.     virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
  711.  
  712.     /**
  713.        A Window Manager should subclass NETRootInfo and reimplement this function
  714.        when it wants to know when a Client made a request to change the current
  715.        desktop.
  716.  
  717.        @param desktop the number of the desktop
  718.     **/
  719.     virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
  720.  
  721.     /**
  722.        @deprecated Use NETRootInfo2::changeActiveWindow() instead.
  723.        A Window Manager should subclass NETRootInfo and reimplement this function
  724.        when it wants to know when a Client made a request to change the active
  725.        (focused) window. The changeActiveWindow() method in NETRootInfo2
  726.        should be used instead.
  727.  
  728.        @param window the id of the window to activate
  729.     **/
  730.     virtual KDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
  731.  
  732.     /**
  733.        A Window Manager should subclass NETRootInfo and reimplement this function
  734.        when it wants to know when a Client made a request to close a window.
  735.  
  736.        @param window the id of the window to close
  737.     **/
  738.     virtual void closeWindow(Window window) { Q_UNUSED(window); }
  739.  
  740.     /**
  741.        A Window Manager should subclass NETRootInfo and reimplement this function
  742.        when it wants to know when a Client made a request to start a move/resize.
  743.  
  744.        @param window The window that wants to move/resize
  745.  
  746.        @param x_root X position of the cursor relative to the root window.
  747.  
  748.        @param y_root Y position of the cursor relative to the root window.
  749.  
  750.        @param direction One of NET::Direction (see base class documentation for
  751.        a description of the different directions).
  752.     **/
  753.     virtual void moveResize(Window window, int x_root, int y_root,
  754.                     unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
  755.  
  756.  
  757. private:
  758.     void update( const unsigned long[] );
  759.     void setSupported();
  760.     void setDefaultProperties();
  761.     void updateSupportedProperties( Atom atom );
  762.     Role role;
  763.  
  764. protected:
  765.     virtual void virtual_hook( int id, void* data );
  766. private:
  767.     NETRootInfoPrivate *p;
  768.     friend class NETRootInfo2;
  769.     friend class NETRootInfo3;
  770. };
  771.  
  772. /**
  773.  This class is an extension of the NETRootInfo class, and exists solely
  774.  for binary compatibility reasons (adds new virtual methods). Simply
  775.  use it instead of NETRootInfo and override also the added virtual methods.
  776.  @since 3.2
  777. */
  778. class KDECORE_EXPORT NETRootInfo2
  779.     : public NETRootInfo
  780. {
  781. public:
  782.     NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
  783.         unsigned long properties[], int properties_size,
  784.                 int screen = -1, bool doActivate = true);
  785.     /**
  786.      * @since 3.5
  787.      */
  788.     NETRootInfo2(Display *display, const unsigned long properties[], int properties_size,
  789.                 int screen = -1, bool doActivate = true);
  790.     /**
  791.       Sends a ping with the given timestamp to the window, using
  792.       the _NET_WM_PING protocol.
  793.     */
  794.     void sendPing( Window window, Time timestamp );
  795. protected:
  796.     friend class NETRootInfo;
  797.     /**
  798.        A Window Manager should subclass NETRootInfo2 and reimplement this function
  799.        when it wants to receive replies to the _NET_WM_PING protocol.
  800.        @param window the window from which the reply came
  801.        @param timestamp timestamp of the ping
  802.      */
  803.     virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
  804.     /**
  805.        A Window Manager should subclass NETRootInfo2 and reimplement this function
  806.        when it wants to know when a Client made a request to change the active
  807.        (focused) window.
  808.  
  809.        @param window the id of the window to activate
  810.        @param src the source from which the request came
  811.        @param timestamp the timestamp of the user action causing this request
  812.        @param active_window active window of the requesting application, if any
  813.     **/
  814.     virtual void changeActiveWindow(Window window,NET::RequestSource src,
  815.         Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
  816.     /**
  817.        A Window Manager should subclass NETRootInfo2 and reimplement this function
  818.        when it wants to know when a Client made a request to restack a window.
  819.        See _NET_RESTACK_WINDOW for details.
  820.  
  821.        @param window the id of the window to restack
  822.        @param above other window in the restack request
  823.        @param detail restack detail
  824.     **/
  825.     virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
  826.  
  827.     /**
  828.        A Window Manager should subclass NETRootInfo2 and reimplement this function
  829.        when it wants to know when a pager made a request to move/resize a window.
  830.        See _NET_MOVERESIZE_WINDOW for details.
  831.  
  832.        @param window the id of the window to more/resize
  833.        @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
  834.        @param x Requested X position for the window
  835.        @param y Requested Y position for the window
  836.        @param width Requested width for the window
  837.        @param height Requested height for the window
  838.     **/
  839.     virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { Q_UNUSED(window); Q_UNUSED(flags); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); }
  840.  
  841. // no private data, use NETRootInfoPrivate
  842. };
  843.  
  844. /**
  845.  This class is an extension of the NETRootInfo class, and exists solely
  846.  for binary compatibility reasons (adds new virtual methods). Simply
  847.  use it instead of NETRootInfo and override also the added virtual methods.
  848.  @since 3.3
  849. */
  850. class KDECORE_EXPORT NETRootInfo3
  851.     : public NETRootInfo2
  852. {
  853. public:
  854.     NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
  855.         unsigned long properties[], int properties_size,
  856.                 int screen = -1, bool doActivate = true);
  857.     /**
  858.      * @since 3.5
  859.      */
  860.     NETRootInfo3(Display *display, const unsigned long properties[], int properties_size,
  861.                 int screen = -1, bool doActivate = true);
  862.     /**
  863.        Sends a take activity message with the given timestamp to the window, using
  864.        the _NET_WM_TAKE_ACTIVITY protocol (see the WM spec for details).
  865.        @param window the window to which the message should be sent
  866.        @param timestamp timestamp of the message
  867.        @param flags arbitrary flags
  868.     */
  869.     void takeActivity( Window window, Time timestamp, long flags );
  870. protected:
  871.     friend class NETRootInfo;
  872.     /**
  873.        A Window Manager should subclass NETRootInfo3 and reimplement this function
  874.        when it wants to know when a Client made a request to restack a window.
  875.        See _NET_RESTACK_WINDOW for details.
  876.  
  877.        @param window the id of the window to restack
  878.        @param source the source of the request
  879.        @param above other window in the restack request
  880.        @param detail restack detail
  881.        @param timestamp the timestamp of the request
  882.     **/
  883.     virtual void restackWindow(Window window, RequestSource source,
  884.            Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
  885.     /**
  886.        A Window Manager should subclass NETRootInfo3 and reimplement this function
  887.        when it wants to receive replies to the _NET_WM_TAKE_ACTIVITY protocol.
  888.        @param window the window from which the reply came
  889.        @param timestamp timestamp of the ping
  890.        @param flags flags passed in the original message
  891.      */
  892.     virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
  893. // no private data, use NETRootInfoPrivate
  894. };
  895.  
  896. /**
  897.  This class is an extension of the NETRootInfo class, and exists solely
  898.  for binary compatibility reasons (adds new virtual methods). Simply
  899.  use it instead of NETRootInfo and override also the added virtual methods.
  900.  @since 3.5
  901. */
  902. class KDECORE_EXPORT NETRootInfo4
  903.     : public NETRootInfo3
  904. {
  905. public:
  906.     NETRootInfo4(Display *display, Window supportWindow, const char *wmName,
  907.         unsigned long properties[], int properties_size,
  908.                 int screen = -1, bool doActivate = true);
  909.     NETRootInfo4(Display *display, const unsigned long properties[], int properties_size,
  910.                 int screen = -1, bool doActivate = true);
  911.  
  912. protected:
  913.     friend class NETRootInfo;
  914.     /**
  915.        A Window Manager should subclass NETRootInfo2 and reimplement this function
  916.        when it wants to know when a pager made a request to change showing the desktop.
  917.        See _NET_SHOWING_DESKTOP for details.
  918.        
  919.        @param showing whether to activate the showing desktop mode
  920.     **/
  921.     virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
  922. // no private data, use NETRootInfoPrivate
  923. };
  924.  
  925. /**
  926.    Common API for application window properties/protocols.
  927.  
  928.    The NETWinInfo class provides a common API for clients and window managers to
  929.    set/read/change properties on an application window as defined by the NET
  930.    Window Manager Specification.
  931.  
  932.    @author Bradley T. Hughes <bhughes@trolltech.com>
  933.    @see NET
  934.    @see NETRootInfo
  935.    @see KWin
  936.    @see http://www.freedesktop.org/standards/wm-spec/
  937.  **/
  938.  
  939. class KDECORE_EXPORT NETWinInfo : public NET {
  940. public:
  941.     /**
  942.         Indexes for the properties array.
  943.         @since 3.2
  944.     **/
  945.     // update also NETWinInfoPrivate::properties[] size when extending this
  946.     enum { PROTOCOLS, PROTOCOLS2,
  947.         PROPERTIES_SIZE };
  948.     /**
  949.        Create a NETWinInfo object, which will be used to set/read/change
  950.        information stored on an application window.
  951.  
  952.        @param display An X11 Display struct.
  953.  
  954.        @param window The Window id of the application window.
  955.  
  956.        @param rootWindow The Window id of the root window.
  957.  
  958.        @param properties An array of elements listing all properties the client
  959.        is interested in.The elements contain OR'ed values of constants
  960.        from the NET base class, in the following order: [0]= NET::Property,
  961.        [1]= NET::Property2.
  962.        In future versions, the list may be extended. In case you pass less elements,
  963.        the missing ones will be replaced with default values.
  964.        
  965.        @param properties_size The number of elements in the properties array.
  966.  
  967.        @param role Select the application role.  If this argument is omitted,
  968.        the role will default to Client.
  969.        
  970.        @since 3.2
  971.     **/
  972.     NETWinInfo(Display *display, Window window, Window rootWindow,
  973.                const unsigned long properties[], int properties_size,
  974.            Role role = Client);
  975.  
  976.     /**
  977.         This constructor differs from the above one only in the way it accepts
  978.         the list of properties the client is interested in. The properties argument
  979.         is equivalent to the first element of the properties array
  980.         in the above constructor.
  981.     **/
  982.     NETWinInfo(Display *display, Window window,
  983.            Window rootWindow, unsigned long properties,
  984.            Role role = Client);
  985.  
  986.     /**
  987.        Creates a shared copy of the specified NETWinInfo object.
  988.  
  989.        @param wininfo the NETWinInfo to copy
  990.     **/
  991.     NETWinInfo(const NETWinInfo & wininfo);
  992.  
  993.     /**
  994.        Destroys the NETWinInfo object.
  995.     **/
  996.     virtual ~NETWinInfo();
  997.  
  998.     /**
  999.        Assignment operator.  Ensures that the shared data reference counts are
  1000.        correct.
  1001.     **/
  1002.     const NETWinInfo &operator=(const NETWinInfo &wintinfo);
  1003.  
  1004.     /**
  1005.        Returns true if the window has any window type set, even if the type
  1006.        itself is not known to this implementation. Presence of a window type
  1007.        as specified by the NETWM spec is considered as the window supporting
  1008.        this specification.
  1009.        @since 3.2
  1010.        @return true if the window has support for the NETWM spec
  1011.     **/
  1012.     bool hasNETSupport() const;
  1013.  
  1014.     /**
  1015.        Returns the properties argument passed to the constructor.
  1016.        The size is the maximum array size the constructor accepts.
  1017.  
  1018.        @since 3.2
  1019.     **/
  1020.     // KDE4 better name?
  1021.     const unsigned long* passedProperties() const;
  1022.  
  1023.     /**
  1024.        @deprecated
  1025.        
  1026.        Returns an OR'ed list of protocols passed to the constructor.
  1027.        
  1028.        @return an OR'ed list of protocols
  1029.  
  1030.        @see NET::Property
  1031.     **/
  1032.     unsigned long properties() const KDE_DEPRECATED;
  1033.  
  1034.     /**
  1035.        Returns the icon geometry.
  1036.  
  1037.        @return the geometry of the icon
  1038.     **/
  1039.     NETRect iconGeometry() const;
  1040.  
  1041.     /**
  1042.        Returns the state of the window (see the NET base class documentation for a
  1043.        description of the various states).
  1044.  
  1045.        @return the state of the window
  1046.     **/
  1047.     unsigned long state() const;
  1048.  
  1049.     /**
  1050.        Returns the extended (partial) strut specified by this client.
  1051.        See _NET_WM_STRUT_PARTIAL in the spec.
  1052.     **/
  1053.     NETExtendedStrut extendedStrut() const;
  1054.  
  1055.     /**
  1056.        @deprecated use strutPartial()
  1057.        Returns the strut specified by this client.
  1058.  
  1059.        @return the strut of the window
  1060.     **/
  1061.     NETStrut strut() const;
  1062.  
  1063.     /**
  1064.        Returns the window type for this client (see the NET base class
  1065.        documentation for a description of the various window types).
  1066.        Since clients may specify several windows types for a window
  1067.        in order to support backwards compatibility and extensions
  1068.        not available in the NETWM spec, you should specify all
  1069.        window types you application supports (see the NET::WindowTypeMask
  1070.        mask values for various window types). This method will
  1071.        return the first window type that is listed in the supported types,
  1072.        or NET::Unknown if none of the window types is supported.
  1073.  
  1074.        @return the type of the window
  1075.        @since 3.2
  1076.     **/
  1077.     WindowType windowType( unsigned long supported_types ) const;
  1078.  
  1079.     /**
  1080.        @deprecated
  1081.        Returns the window type for this client (see the NET base class
  1082.        documentation for a description of the various window types).
  1083.  
  1084.        @return the type of the window
  1085.     **/
  1086.     WindowType windowType() const KDE_DEPRECATED;
  1087.  
  1088.     /**
  1089.        Returns the name of the window in UTF-8 format.
  1090.  
  1091.        @return the name of the window
  1092.     **/
  1093.     const char *name() const;
  1094.  
  1095.     /**
  1096.        Returns the visible name as set by the window manager in UTF-8 format.
  1097.  
  1098.        @return the visible name of the window
  1099.     **/
  1100.     const char *visibleName() const;
  1101.  
  1102.     /**
  1103.        Returns the iconic name of the window in UTF-8 format. Note that this has
  1104.        nothing to do with icons, but it's for "iconic"
  1105.        representations of the window (taskbars etc.), that should be shown
  1106.        when the window is in iconic state. See description of _NET_WM_ICON_NAME
  1107.        for details.
  1108.        
  1109.        @return the iconic name
  1110.     **/
  1111.     const char *iconName() const;
  1112.  
  1113.     /**
  1114.        Returns the visible iconic name as set by the window manager in UTF-8 format.
  1115.        Note that this has nothing to do with icons, but it's for "iconic"
  1116.        representations of the window (taskbars etc.), that should be shown
  1117.        when the window is in iconic state. See description of _NET_WM_VISIBLE_ICON_NAME
  1118.        for details.
  1119.  
  1120.        @return the visible iconic name
  1121.     **/
  1122.     const char *visibleIconName() const;
  1123.  
  1124.     /**
  1125.        Returns the desktop where the window is residing.
  1126.  
  1127.        @return the number of the window's desktop
  1128.  
  1129.        @see OnAllDesktops()
  1130.     **/
  1131.     int desktop() const;
  1132.  
  1133.     /**
  1134.        Returns the process id for the client window.
  1135.  
  1136.        @return the process id of the window
  1137.     **/
  1138.     int pid() const;
  1139.  
  1140.     /**
  1141.        Returns whether or not this client handles icons.
  1142.  
  1143.        @return true if this client handles icons, false otherwise
  1144.     **/
  1145.     Bool handledIcons() const;
  1146.  
  1147.     /**
  1148.        Returns a Window id, telling the window manager which window we are
  1149.        representing.
  1150.  
  1151.        @return the window id
  1152.     **/
  1153.     Window kdeSystemTrayWinFor() const;
  1154.  
  1155.     /**
  1156.        Returns the mapping state for the window (see the NET base class
  1157.        documentation for a description of mapping state).
  1158.  
  1159.        @return the mapping state
  1160.     **/
  1161.     MappingState mappingState() const;
  1162.  
  1163.     /**
  1164.        Set icons for the application window.  If replace is True, then
  1165.        the specified icon is defined to be the only icon.  If replace is False,
  1166.        then the specified icon is added to a list of icons.
  1167.  
  1168.        @param icon the new icon
  1169.        
  1170.        @param replace true to replace, false to append to the list of icons
  1171.     **/
  1172.     void setIcon(NETIcon icon, Bool replace = True);
  1173.  
  1174.     /**
  1175.        Set the icon geometry for the application window.
  1176.  
  1177.        @param geometry the new icon geometry
  1178.     **/
  1179.     void setIconGeometry(NETRect geometry);
  1180.  
  1181.     /**
  1182.        Set the extended (partial) strut for the application window.
  1183.  
  1184.        @param extended_strut the new strut
  1185.     **/
  1186.     void setExtendedStrut(const NETExtendedStrut& extended_strut );
  1187.  
  1188.     /**
  1189.        @deprecated use setExtendedStrut()
  1190.        Set the strut for the application window.
  1191.  
  1192.        @param strut the new strut
  1193.     **/
  1194.     void setStrut(NETStrut strut);
  1195.  
  1196.     /**
  1197.        Set the state for the application window (see the NET base class documentation
  1198.        for a description of window state). Note that the constructor needs to be
  1199.        passed NET::WMState in properties even if it's only used for setting the state
  1200.        without reading it.
  1201.  
  1202.        @param state the name state
  1203.  
  1204.        @param mask the mask for the state
  1205.     **/
  1206.     void setState(unsigned long state, unsigned long mask);
  1207.  
  1208.     /**
  1209.        Sets the window type for this client (see the NET base class
  1210.        documentation for a description of the various window types).
  1211.  
  1212.        @param type the window type
  1213.     **/
  1214.     void setWindowType(WindowType type);
  1215.  
  1216.     /**
  1217.        Sets the name for the application window.
  1218.  
  1219.        @param name the new name of the window
  1220.     **/
  1221.     void setName(const char *name);
  1222.  
  1223.     /**
  1224.        For Window Managers only:  set the visible name ( i.e. xterm, xterm <2>,
  1225.        xterm <3>, ... )
  1226.  
  1227.        @param visibleName the new visible name
  1228.     **/
  1229.     void setVisibleName(const char *visibleName);
  1230.  
  1231.     /**
  1232.        Sets the iconic name for the application window.
  1233.  
  1234.        @param name the new iconic name
  1235.     **/
  1236.     void setIconName(const char *name);
  1237.  
  1238.     /**
  1239.        For Window Managers only: set the visible iconic name ( i.e. xterm, xterm <2>,
  1240.        xterm <3>, ... )
  1241.  
  1242.        @param name the new visible iconic name
  1243.     **/
  1244.     void setVisibleIconName(const char *name);
  1245.  
  1246.     /**
  1247.        Set which window the desktop is (should be) on.
  1248.  
  1249.        @param desktop the number of the new desktop
  1250.        
  1251.        @see OnAllDesktops()
  1252.     **/
  1253.     void setDesktop(int desktop);
  1254.  
  1255.     /**
  1256.        Set the application window's process id.
  1257.  
  1258.        @param pid the window's process id
  1259.     **/
  1260.     void setPid(int pid);
  1261.  
  1262.     /**
  1263.        Set whether this application window handles icons.
  1264.  
  1265.        @param handled true if the window handles icons, false otherwise
  1266.     **/
  1267.     void setHandledIcons(Bool handled);
  1268.  
  1269.     /**
  1270.        Set which window we are representing as a system tray window.
  1271.  
  1272.        @param window the window that is represented by the system tray icon
  1273.     **/
  1274.     void setKDESystemTrayWinFor(Window window);
  1275.  
  1276.     /**
  1277.        Set the frame decoration strut, i.e. the width of the decoration borders.
  1278.        
  1279.        @param strut the new strut
  1280.        @since 3.5
  1281.     **/
  1282.     void setFrameExtents(NETStrut strut);
  1283.  
  1284.     /**
  1285.        Set the frame decoration strut.  This is a KDE 2.0 extension to aid in
  1286.        writing pager applications.
  1287.  
  1288.        @param strut the new strut
  1289.     **/
  1290.     void setKDEFrameStrut(NETStrut strut);
  1291.  
  1292.     /**
  1293.        Returns an icon.  If width and height are passed, the icon returned will be
  1294.        the closest it can find (the next biggest).  If width and height are omitted,
  1295.        then the largest icon in the list is returned.
  1296.  
  1297.        @param width the preferred width for the icon, -1 to ignore
  1298.  
  1299.        @param height the preferred height for the icon, -1 to ignore
  1300.  
  1301.        @return the icon
  1302.     **/
  1303.     NETIcon icon(int width = -1, int height = -1) const;
  1304.  
  1305.     /*    
  1306.      * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
  1307.      * The timestamp is expressed as XServer time. If a window
  1308.      * is shown with user timestamp older than the time of the last
  1309.      * user action, it won't be activated after being shown, with the special
  1310.      * value 0 meaning not to activate the window after being shown.
  1311.      * @since 3.2
  1312.      */
  1313.     void setUserTime( Time time );
  1314.     
  1315.     /**
  1316.      * Returns the time of last user action on the window, or -1 if not set.
  1317.      * @since 3.2
  1318.      */
  1319.     Time userTime() const;
  1320.  
  1321.     /*    
  1322.      * Sets the startup notification id @p id on the window.
  1323.      * @since 3.2
  1324.      */
  1325.     void setStartupId( const char* startup_id );
  1326.     
  1327.     /**
  1328.      * Returns the startup notification id of the window.
  1329.      * @since 3.2
  1330.      */
  1331.     const char* startupId() const;
  1332.  
  1333.     /**
  1334.      * Sets actions that the window manager allows for the window.
  1335.      * @since 3.2
  1336.      */
  1337.     void setAllowedActions( unsigned long actions );
  1338.  
  1339.     /**
  1340.      * Returns actions that the window manager allows for the window.
  1341.      * @since 3.2
  1342.      */
  1343.     unsigned long allowedActions() const;
  1344.  
  1345.     /*
  1346.      * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
  1347.      * for this window.
  1348.      * @since 3.2
  1349.      */
  1350.     Window transientFor() const;
  1351.  
  1352.     /**
  1353.      * Returns the leader window for the group the window is in, if any.
  1354.      * @since 3.2
  1355.      */    
  1356.     Window groupLeader() const;
  1357.     
  1358.     /**
  1359.      * Returns the class component of the window class for the window
  1360.      * (i.e. WM_CLASS property).
  1361.      * @since 3.3
  1362.      */
  1363.     const char* windowClassClass() const;
  1364.  
  1365.     /**
  1366.      * Returns the name component of the window class for the window
  1367.      * (i.e. WM_CLASS property).
  1368.      * @since 3.3
  1369.      */
  1370.     const char* windowClassName() const;
  1371.  
  1372.     /**
  1373.      * Returns the window role for the window (i.e. WM_WINDOW_ROLE property).
  1374.      * @since 3.3
  1375.      */
  1376.     const char* windowRole() const;
  1377.  
  1378.     /**
  1379.      * Returns the client machine for the window (i.e. WM_CLIENT_MACHINE property).
  1380.      * @since 3.3
  1381.      */
  1382.     const char* clientMachine() const;
  1383.  
  1384.     /**
  1385.        Places the window frame geometry in frame, and the application window
  1386.        geometry in window.  Both geometries are relative to the root window.
  1387.  
  1388.        @param frame the geometry for the frame
  1389.  
  1390.        @param window the geometry for the window
  1391.     **/
  1392.     void kdeGeometry(NETRect &frame, NETRect &window);
  1393.  
  1394.     /**
  1395.        This function takes the passed XEvent and returns an OR'ed list of
  1396.        NETWinInfo properties that have changed in the properties argument.
  1397.        The new information will be read immediately by the class.
  1398.        The elements of the properties argument are as they would be passed
  1399.        to the constructor, if the array is not large enough,
  1400.        changed properties that don't fit in it won't be listed there
  1401.        (they'll be updated in the class though).
  1402.        
  1403.        @param event the event
  1404.        @param properties properties that changed
  1405.        @param properties_size size of the passed properties array
  1406.        @since 3.2
  1407.  
  1408.     **/
  1409.     void event( XEvent* event, unsigned long* properties, int properties_size );
  1410.  
  1411.     /**
  1412.        This function takes the pass XEvent and returns an OR'ed list of NETWinInfo
  1413.        properties that have changed.  The new information will be read
  1414.        immediately by the class. This overloaded version returns
  1415.        only a single mask, and therefore cannot check state of all properties
  1416.        like the other variant.
  1417.  
  1418.        @param event the event
  1419.  
  1420.        @return the properties
  1421.     **/
  1422.     unsigned long event(XEvent *event);
  1423.  
  1424.     /**
  1425.        Sentinel value to indicate that the client wishes to be visible on
  1426.        all desktops.
  1427.  
  1428.        @return the value to be on all desktops
  1429.     **/
  1430.     static const int OnAllDesktops;
  1431.  
  1432.  
  1433. protected:
  1434.     /**
  1435.        A Window Manager should subclass NETWinInfo and reimplement this function when
  1436.        it wants to know when a Client made a request to change desktops (ie. move to
  1437.        another desktop).
  1438.  
  1439.        @param desktop the number of the desktop
  1440.     **/
  1441.     virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
  1442.  
  1443.     /**
  1444.        A Window Manager should subclass NETWinInfo and reimplement this function when
  1445.        it wants to know when a Client made a request to change state (ie. to
  1446.        Shade / Unshade).
  1447.  
  1448.        @param state the new state
  1449.  
  1450.        @param mask the mask for the state
  1451.     **/
  1452.     virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
  1453.  
  1454. private:
  1455.     void update( const unsigned long[] );
  1456.     void updateWMState();
  1457.     void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
  1458.     NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
  1459.     Role role;
  1460.  
  1461. protected:
  1462.     virtual void virtual_hook( int id, void* data );
  1463. private:
  1464.     NETWinInfoPrivate *p;
  1465. };
  1466.  
  1467.  
  1468. //#define KWIN_FOCUS
  1469.  
  1470. #endif
  1471. #endif // __net_wm_h
  1472.